<%@ page import="com.headline.common.CookieHelper" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/11/8
  Time: 13:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String loginUser = "";
    int loginUserId = 0;
    Cookie cookie = CookieHelper.getCookieByName(request, "wzLoginUser");
    if (cookie != null) {
        String loginUserVal = cookie.getValue();
        if (!loginUserVal.equals("")) {
            String[] cell = loginUserVal.split("\\|");
            if (cell.length > 1) {
                loginUser = cell[0];
                loginUserId = Integer.parseInt(cell[1]);
            }
        }
    }
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<nav class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse"
                data-target="#example-navbar-collapse">
            <span class="sr-only">切换导航</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="">违章助手</a>
    </div>
    <div class="collapse navbar-collapse" id="example-navbar-collapse">
        <ul class="nav navbar-nav">
            <li>
                <a href="<%=basePath%>article/list">
                    文章管理
                </a>
            </li>
            <li class="dropdown">
                <a href="<%=basePath%>admin/users" class="dropdown-toggle" data-toggle="dropdown">
                    用户管理 <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="<%=basePath%>admin/users">用户列表 </a></li>
                    <li><a href="<%=basePath%>admin/users/add">添加用户</a></li>
                </ul>

            </li>
            <li class="dropdown ">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <%=loginUser%> <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li class="active"><a href="<%=basePath%>admin/users/update/<%=loginUserId%>">修改密码</a>
                    </li>
                    <li><a href="<%=basePath%>indexLoginOut">退出登录</a></li>
                    <li class="divider"></li>
                </ul>
            </li>
            <%--<li><a href="#">退出登录</a></li>--%>
        </ul>
    </div>
</nav>